
import http from './http.js'
import path from './path.js'

//创建商品分类
export function addcategory(formDataList) {
    return http.post(path.addcategory,formDataList)
}

// 编辑商品分类
export function editcategory(DataList) {
    return http.post(path.editcategory,DataList)
}

// 获取商品分类列表
export function getlistClass(catName){
    return http.get(path.getlistClass,{params: {
        "catName":catName
    }})
}

// 懒加载分类列表
export function getList(catName) {
    const params = {
        "catName":catName
    }
    return http.get(path.getlist,{params})
}

//删除商品分类
export function delClass(id){
    const params = {
        "id": id
    }
    return http.get(path.delClass, {params})
}

// 查看分类
export function getQuery(id){
    const params = {
        "id": id
    }
    return http.get(path.getqueryById, {params})
}

// 获取品牌列表
export function getbrandslist(data){
    const params = {
        brandName:data.brandName,
        pageNo:data.pageNo,
        pageSize:data.pageSize,
        sort:data.sort,
        sortType:data.sortType,
        status:data.status   
    }
    return http.get(path.getbrandList,{params})
}

//品牌管理弹窗上传图片
export function uploadImg(data){
    const files= data
    return http.post(path.uploadImg,files)
}

//品牌管理探窗新增品牌
export function addBrand(data){
    const params = {
        "brandName": data.brandName,
        "letter":data.letter,
        "logo": data.logo,
        "applyType":1
    }
    return http.post(path.applybrand,params)
}

//品牌管理弹窗编辑品牌
export function editBrand(data){
    console.log(data)
    const params = {
        "brandName": data.brandName,
        "id": data.id,
        "letter": data.letter,
        "logo":data.logo    
    }
    console.log(params)
    return http.put(path.editBrand,params)
}

//品牌管理列表删除品牌
export function deleteBrand(data){
    const params ={
        "id": data.id
    }
    return http.delete(path.delBrand, {params})
}

//品牌管理列表修改收录状态
export function changeStatus(data){
    const params = {
        "id": data.id,
        "status": data.status,
        "refuseMemo": data.refuseReason,
    }
    return http.post(path.changeStatus,params)
}

//品牌管理批量收入或者拒收
export function batchChangeStatus(data){
    const params = {
        "ids": data.ids,
        "refuseMemo": data.refuseReason,
        "status": data.status
    }
    return http.post(path.batchChangeStatus,params)
}
